"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// 2.用es5的语法写单例模式
function Window() { }
;
Window.prototype.hello = function () {
    console.log('hello--我是es5！！');
};
Window.getInstance2 = (function () {
    var instance2;
    return function () {
        if (!instance2) {
            console.log('2 没有走缓存');
            return instance2 = new Window();
        }
        ;
        console.log('2 走缓存');
        return instance2;
    };
})();
//2 测试单例
// new (Window as any)().hello();
var w11 = Window.getInstance2();
var w22 = Window.getInstance2();
console.log("2 \u4E24\u4E2A\u5B9E\u4F8B\u662F\u5426\u4E00\u6837" + (w11 == w22));
